/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author PR
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface ShopGiftData extends BasicModel<ShopGiftData> {
  name?: string; // 政策名称
  ddate?: string; // 日期
  cusCode?: string; // 经销商
  invCode?: string; // 物料编码
  iqty?: number; // 数量
  effDate?: string; // 生效日期
  expDate?: string; // 失效日期
}

export const shopGiftDataList = (params?: ShopGiftData | any) =>
  defHttp.get<ShopGiftData>({ url: adminPath + '/shop/gift/shopGiftData/list', params });

export const shopGiftDataListData = (params?: ShopGiftData | any) =>
  defHttp.post<Page<ShopGiftData>>({ url: adminPath + '/shop/gift/shopGiftData/listData', params });

export const shopGiftDataForm = (params?: ShopGiftData | any) =>
  defHttp.get<ShopGiftData>({ url: adminPath + '/shop/gift/shopGiftData/form', params });

export const shopGiftDataSave = (params?: any, data?: ShopGiftData | any) =>
  defHttp.postJson<ShopGiftData>({ url: adminPath + '/shop/gift/shopGiftData/save', params, data });

export const shopGiftDataImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/shop/gift/shopGiftData/importData',
      onUploadProgress,
    },
    params,
  );

export const shopGiftDataDelete = (params?: ShopGiftData | any) =>
  defHttp.get<ShopGiftData>({ url: adminPath + '/shop/gift/shopGiftData/delete', params });

// disStatus
export const shopGiftDataDisStatus = (params?: ShopGiftData | any) =>
  defHttp.get<ShopGiftData>({ url: adminPath + '/shop/gift/shopGiftData/disStatus', params });
